<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html" xmlns:p="http://primefaces.org/ui" template="/WEB-INF/templates/notConnected.xhtml">
	<ui:define name="content">
		<h:form id="formUserGestion">
			<p:wizard id="inscriptionWizard" nextLabel="#{bundles.i18n.wizard_next}" backLabel="#{bundles.i18n.wizard_back}">
				<p:tab id="type" title="Compte">
					<h:messages errorClass="error" />
					<p:panel id="typeUser" header="#{bundles.i18n.inscription_qui}">
						<h:panelGrid columns="2" columnClasses="label, value" styleClass="grid">
							<h:outputText value="Options: " />
							<p:selectOneRadio id="options" value="#{inscriptionMBean.form}" onchange="lazyload()">
								<f:selectItem itemLabel="#{bundles.i18n.customer}" itemValue="customerInscription" />
								<f:selectItem itemLabel="#{bundles.i18n.manager}" itemValue="managerInscription" />
								<f:selectItem itemLabel="#{bundles.i18n.employe}" itemValue="employeeInscription" />
							</p:selectOneRadio>
							<p:remoteCommand name="lazyload" update="inscriptionWizard">
							</p:remoteCommand>
						</h:panelGrid>
					</p:panel>
				</p:tab>

				<p:tab id="personnal" title="Personne">
					<p:panel id="panelPersonnal" header="#{bundles.i18n.informationgeneral}">
						<h:messages errorClass="error" />
						<h:panelGrid columns="3" cellspacing="5">
							<p:outputLabel value="Pseudo :" for="pseudo" />
							<p:inputText id="pseudo" value="#{inscriptionMBean.user.pseudo}" label="firtname" required="true" />
							<p:message for="pseudo" />
							<p:outputLabel value="#{bundles.i18n.password} :" for="password" />
							<p:password id="password" value="#{inscriptionMBean.user.password}" feedback="true" label="password" required="true"
								promptLabel="Saisir le mot de passe" weakLabel="leger" goodLabel="moyen" strongLabel="bon" />
							<p:message for="password" />
							<p:outputLabel value="#{bundles.i18n.confirm_password} :" for="confirm_password" />
							<p:password id="confirm_password" value="#{inscriptionMBean.passWordConf}" required="true" />
							<p:message for="confirm_password" />
							<p:outputLabel value="#{bundles.i18n.firstname} :" for="firtname" />
							<p:inputText id="firtname" value="#{inscriptionMBean.user.firtName}" label="firtname" />
							<p:message for="firtname" />
							<p:outputLabel value="#{bundles.i18n.lastname} :" for="lastname" />
							<p:inputText id="lastname" value="#{inscriptionMBean.user.lastName}" label="lastname" />
							<p:message for="lastname" />
							<h:outputLabel value="Email :" for="email" />
							<p:inputText id="email" value="#{inscriptionMBean.user.email}" label="email" />
							<p:message for="email" />
						</h:panelGrid>
					</p:panel>
				</p:tab>

				<p:tab id="company" title="#{bundles.i18n.menu_mysociety}" rendered="#{inscriptionMBean.manager}">
					<h:messages errorClass="error" />
					<p:panel id="panelCompany" header="#{bundles.i18n.company_information}">
						<h:panelGrid columns="2" cellspacing="10">
							<p:outputLabel for="company_name" value="#{bundles.i18n.company_name} :" />
							<p:inputText id="company_name" size="60" value="#{companyController.company.name}" required="true" />
							<p:outputLabel for="company_tel" value="#{bundles.i18n.tel} :" />
							<p:inputMask id="company_tel" mask="99.99.99.99.99" value="#{companyController.company.tel}" required="true" />
						</h:panelGrid>
						<h:panelGrid columns="4" cellspacing="10">
							<p:outputLabel value="#{bundles.i18n.inscription_codepostal} :" for="cp" />
							<p:autoComplete value="#{cityMBean.cpSelected}" id="cp" completeMethod="#{cityMBean.searchCityLikeCP}" dropdown="true" queryDelay="10"
								required="true">
								<p:ajax event="itemSelect" update="city" listener="#{cityMBean.handleSelectCP}" />
							</p:autoComplete>
							<p:outputLabel value="#{bundles.i18n.inscription_city} :" for="cp" />
							<p:selectOneMenu value="#{cityMBean.citySelected}" effect="fade" id="city" converter="CityConverter" required="true">
								<f:selectItem itemLabel="Select One" itemValue="" />
								<f:selectItems value="#{cityMBean.cities}" var="city" itemLabel="#{city.label}" itemValue="#{city}" />
							</p:selectOneMenu>
							<p:outputLabel for="number" value="#{bundles.i18n.street_number} :" />
							<p:inputText id="number" value="#{companyController.company.adress.numRue}" />
							<p:outputLabel for="typeStreet" value="#{bundles.i18n.street_type} :" />
							<p:selectOneMenu value="#{companyController.company.adress.typeRue}" effect="fade" id="typeStreet">
								<f:selectItem itemLabel="Select One" itemValue="" />
								<f:selectItem itemLabel="#{bundles.i18n.street_allee}" itemValue="#{bundles.i18n.street_allee}" />
								<f:selectItem itemLabel="#{bundles.i18n.street_avenue}" itemValue="#{bundles.i18n.street_avenue}" />
								<f:selectItem itemLabel="#{bundles.i18n.street_boulevard}" itemValue="#{bundles.i18n.street_boulevard}" />
								<f:selectItem itemLabel="#{bundles.i18n.street_chemin}" itemValue="#{bundles.i18n.street_chemin}" />
								<f:selectItem itemLabel="#{bundles.i18n.street_impasse}" itemValue="#{bundles.i18n.street_impasse}" />
								<f:selectItem itemLabel="#{bundles.i18n.street_place}" itemValue="#{bundles.i18n.street_place}" />
								<f:selectItem itemLabel="#{bundles.i18n.street_rue}" itemValue="#{bundles.i18n.street_rue}" />
							</p:selectOneMenu>
						</h:panelGrid>
						<h:panelGrid columns="2" cellspacing="10">
							<p:outputLabel for="street" value="#{bundles.i18n.street_rue} :" />
							<p:inputText id="street" size="60" value="#{companyController.company.adress.nomRue}" />
							<p:outputLabel for="complement" value="#{bundles.i18n.adress_complement} :" />
							<p:inputText id="complement" size="60" value="#{companyController.company.adress.complement}" />
						</h:panelGrid>
					</p:panel>
				</p:tab>

				<p:tab id="valid" title="Validation">
					<p:panel id="cvg">
						<p:inputTextarea autoResize="true" readonly="true" value=""></p:inputTextarea>
						<h:panelGrid columns="2" columnClasses="label, value" styleClass="grid">
							<p:selectBooleanCheckbox id="cvgCheck" itemLabel="J'accepte les conditions d'utilisation" value="#{inscriptionMBean.cvgOk}" required="true"
								requiredMessage="Vous devez accepter les conditions générales d'utilisation" />
							<p:commandButton id="submit" value="OK" style="width :80px;"  action="#{inscriptionMBean.createUser}" update="cvg" />
						</h:panelGrid>
					</p:panel>
				</p:tab>
			</p:wizard>
		</h:form>
	</ui:define>
</ui:composition>
